<template>
	<view class="index" :style="{'height':windowHeight}">
		<div class="operate">
			<div class="operates">
				<div class="operates-li" v-for="(item,index) in list" :key="index" @click="Change(item.id)">
					<div class="li-img">
						<image :src="item.img" mode=""></image>
					</div>
					<div class="li-txt">{{item.name}}</div>
				</div>
			</div>
		</div>
	</view>
</template>
<script>
	export default {
		components: {},
		data() {
			return {
				windowHeight: "200px", 
				list:[
					{
						id:1,
						img:'/static/index/f1.png', 
						name:'修改wifi'
					},{
						id:2,
						img:'/static/index/f2.png',
						name:'切换网络'
					},{
						id:3,
						img:'/static/index/f3.png',
						name:'操作指令'
					},{
						id:4,
						img:'/static/index/f1.png', 
						name:'智能锁开关'
					},{
						id:5,
						img:'/static/index/f2.png', 
						name:'上网开关'
					},{
						id:6,
						img:'/static/index/f3.png', 
						name:'隐藏WIFI'
					},{
						id:7,
						img:'/static/index/f1.png', 
						name:'设备限速'
					},{
						id:8,
						img:'/static/index/f2.png', 
						name:'关闭限速'
					},{
						id:9,
						img:'/static/index/f3.png', 
						name:'设备禁用'
					},
				]
			}
		},
		onLoad() {
			this.GaoDu() //判断手机高度
		},
		methods: {
			// 判断手机高度
			GaoDu() {
				console.log('12356')
				// 判断手机页面的高度
				uni.getSystemInfo({

					success: (res) => {
						this.windowHeight = res.windowHeight + "px";
					}
				})
			},
			
			Change(e){
				console.log(e)
				if(e == 1){
					uni.navigateTo({
						url: '/pages/index/operates/wifi'
					});
				}
				if(e == 2){
					uni.navigateTo({
						url: '/pages/index/operates/switchNet'
					});
				}
				if(e == 3){
					uni.navigateTo({
						url: '/pages/index/operates/operateInstruction'
					});
				}
				if(e == 4){
					uni.navigateTo({
						url: '/pages/index/operates/SmartLock'
					});
				}
				if(e == 5){
					uni.navigateTo({
						url: '/pages/index/operates/fastNet'
					});
				}
				if(e == 6){
					uni.navigateTo({
						url: '/pages/index/operates/HideWIFI'
					});
				}
				if(e == 7){
					uni.navigateTo({
						url: '/pages/index/operates/SpeedLimit'
					});
				}
				if(e == 8){
					this.jhCloseLimitSpeed()
				}
				if(e == 9){
					uni.navigateTo({
						url: '/pages/index/operates/deviceDisable'
					});
				}
			},
			// 关闭限速
			jhCloseLimitSpeed(){
				const value = uni.getStorageSync('iponeInfo');
				this.$REQ(this.$api.jhCloseLimitSpeed, {
					sn: value.deviceNo,
				}, 'POST').then(res => {
					console.log(res)
					uni.showToast({
						duration: 1000,
						title:'关闭成功',
						icon: 'none',
					})
				}).catch(err => {
					console.log(err)
					uni.showToast({
						duration: 1000,
						title: err.data.msg,
						icon: 'none',
					})
				})
			},
			
		}
	}
</script>

<style scoped lang="less">
	.index {
		width: 100%;
		height: 100%;
		background: #F5F4F9;
	}
	.operate{
		padding: 30rpx;
	}
	.operates{
		
		border-radius: 10rpx;
		display: flex;
		flex-wrap: wrap;
		border-radius: 1rpx;
	}
	.operates-li{
		width: 32.5%;
		background: #fff;
		border: 1rpx solid #F5F4F9;
		border-radius: 10rpx;
	}
	.li-img{
		width: 50rpx;
		height: 50rpx;
		margin: auto;
		padding-top: 45rpx;
	}
	image{
		width: 100%;
		height: 100%;
	}
	.li-txt{
		text-align: center;
		padding-top: 20rpx;
		padding-bottom: 40rpx;
		font-size: 28rpx;
		
	}
</style>